<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./js/jquery-1.8.2.min.js"></script>
</head>
<body>

<form name="uploadForm" id="uploadForm" method="post" enctype="multipart/form-data"
      action="http://longdi.jbxiong.com/admin/Uploadimg/upload" target="uploadFrame">
    <p style="margin:10px 0;">
        上传图片:   
        <input type="file" name="image" ID="image" />
        <input type="text" name="imgtype" ID="imgtype" value="" />
        <input type="button" id="fileSubmit" name="Submit" value="上传" />
        <iframe name="uploadFrame" id="uploadFrame" style="display:none;"></iframe>

    </p>
</form>

<script>

    $("#fileSubmit").click(function () {
        var formData = new FormData();
        formData.append('image', document.getElementById('image').files[0]);
        formData.append('imgtype','house');
        $.ajax({
            url:"http://longdi.jbxiong.com/admin/Uploadimg/upload",
            type: 'post',
            cache: false, //上传文件不需要缓存
            data: formData,
            processData: false, // 告诉jQuery不要去处理发送的数据
            contentType: false, // 告诉jQuery不要去设置Content-Type请求头
            success: function (data) {
                console.log(data);
            },
            error : function(XMLHttpRequest, textStatus, errorThrown) {
                console.log('fail');
            }
        });
        //if($.browser.msie){
        //window.uploadForm.submit();
        //}else{
        //$("#uploadForm").submit();
        //}
    });
</script>

</body>
</html>